package aiku.numericalcontroloa.Controller.CompanyCulture;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Model.Dto.CompanyCulture.LearnRecordDto;
import aiku.numericalcontroloa.Service.CompanyCulture.LearnRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 学习记录控制层
 * @Author 黄广庭
 * @Date 2024/1/25 11:06
 */
@RestController
@RequestMapping("/learnRecord")
@Slf4j
public class LearnRecordCont {
    private final LearnRecordService learnRecordService;

    public LearnRecordCont(LearnRecordService learnRecordService) {
        this.learnRecordService = learnRecordService;
    }

    /**
     * 查询学习记录列表，可按标题，名字模糊查询
     * @param learnRecordDto
     * @return
     */
    @PostMapping("/getLearnRecordList")
    public Result getLearnRecordList(@RequestBody LearnRecordDto learnRecordDto){
        return learnRecordService.getLearnRecordList(learnRecordDto);
    }

    @PostMapping("/getLearnRecordGropList")
    public Result getLearnRecordGropList(@RequestBody LearnRecordDto learnRecordDto){
        return learnRecordService.getLearnRecordGropList(learnRecordDto);
    }

    /**
     * 获取个人学习记录
     * @param learnRecordDto
     * @return
     */
    @PostMapping("/getLearnRecord")
    public Result getLearnRecord(@RequestBody LearnRecordDto learnRecordDto){
        return learnRecordService.getLearnRecord(learnRecordDto);
    }

    /**
     * 改变学习状态
     * @param learnRecordDto
     * @return
     */
    @PostMapping("/changeStatus")
    public Result changeStatus(@RequestBody LearnRecordDto learnRecordDto){
        return learnRecordService.changeStatus(learnRecordDto);
    }
}
